package com.voltmao.webpro.utils.Json;

import com.google.gson.internal.LinkedTreeMap;
import com.voltmao.webpro.utils.JsonUtil;

import java.util.ArrayList;

public class JsonMap implements Cloneable {
    private Object pointObj;

    public JsonMap(String obj) {
        pointObj = JsonUtil.ToMap(obj);
    }

    public JsonMap getKey(String key) {
        pointObj = ((LinkedTreeMap<String, Object>) pointObj).get(key);
        return this;
    }

    public LinkedTreeMap<String, Object> toMap() {
        return (LinkedTreeMap<String, Object>) pointObj;
    }

    public ArrayList<LinkedTreeMap<String, Object>> toListMap() {
        return (ArrayList<LinkedTreeMap<String, Object>>) pointObj;
    }

    public Object getObj() {
        return pointObj;
    }

    public String toJsonStr() {
        return JsonUtil.ObjectToJSON(pointObj);
    }


    public static void main(String[] args) {

    }
}

